<?php

namespace app\common\model\course;

use app\admin\model\Comment;
use think\Model;

/**
 * Course
 */
class CourseUserComment extends Model
{
    // 表名
    protected $name = 'course_user_comment';

    // 自动写入时间戳字段
    protected $autoWriteTimestamp = true;
    protected $append = [
        'create_time_text',
    ];

    public function getAvatarAttr($value)
    {
        return !$value ? '' : full_url($value);
    }

    public function course()
    {
        return $this->belongsTo(Course::class);
    }

    public function getCreateTimeTextAttr($value)
    {
        return date('Y-m-d H:i:s', $value);
    }
}
